<?php


namespace App\Http\Controllers\User;


use App\Http\Common\BaseController;
use App\Models\User;
use Illuminate\Http\Request;

class UserController extends BaseController
{
    /**
     * 获取登录用户或管理员的路由
     * @param Request $request
     * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\Routing\ResponseFactory|\Illuminate\Http\Response
     */
    public function getRouteList(Request $request){
        //获取用户信息
        $userInfo = User::find($request->userId);

        //获取所有路由
        $routeAll = $this->getRouteAll($request->userId);

        //获取权限
        $role_id = $this->getUserRole($request->userId);

        $userInfo['role_id'] = $role_id;
        $userInfo['routeAll'] = $routeAll;
        return $this->returnJson(BaseController::SUCCESS, '数据获取成功', $userInfo);
    }

}
